package com.ruoyi.common.enums;

public enum TaskType {
    DAILY("0", "每日"),
    MONTHLY("1", "每月"),
    BEGINNER("2", "新手");

    private final String code;
    private final String description;

    TaskType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码查找对应的任务类型
    public static TaskType getByCode(String code) {
        for (TaskType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid Task Type code: " + code);
    }
}
